package common.db.test.processor;

import common.db.test.entity.ProbaDva;
import common.db.handlers.ListHandler;
import common.db.handlers.OneRowHandler;
import common.db.DBUtilis;
import common.db.RowProcessor;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by IntelliJ IDEA.
 * User: Paskal
 * Date: Apr 26, 2009
 * Time: 6:51:47 PM
 * To change this template use File | Settings | File Templates.
 */
public class ProbaDvaProcessor implements RowProcessor
{
	private final static ListHandler<ProbaDva> LIST_HANDLER = ListHandler.getInstance(new ProbaDvaProcessor());
	private final static OneRowHandler<ProbaDva> ONE_ROW_HANDLER = OneRowHandler.getInstance(new ProbaDvaProcessor());


	public static ListHandler<ProbaDva> getListHandler()
	{
		return LIST_HANDLER;
	}

	public static OneRowHandler<ProbaDva> getOneRowHandler()
	{
		return ONE_ROW_HANDLER;
	}


	public ProbaDvaProcessor()
	{

	}

	public ProbaDva processRow(ResultSet rs) throws SQLException
	{
		return new ProbaDva(
				rs.getInt("id"),
				rs.getString("name"),
				rs.getString("description"),
				DBUtilis.getInteger(rs, "number_Id")
		);
	}
}